Skip to content

Break out runs and batches per type, removing ID-prefix inference - #34

Open
jordanalexmeyer wants to merge 5 commits into
jam/cli-workos-connectfrom
jam/typed-runs-batches
Open

Break out runs and batches per type, removing ID-prefix inference#34
jordanalexmeyer wants to merge 5 commits into
jam/cli-workos-connectfrom
jam/typed-runs-batches

Conversation

@jordanalexmeyer

Copy link
Copy Markdown
Contributor

Summary

Restructures run inspection/control and batch status into typed per-verb subcommands, mirroring the MCP server's per-type tool breakout and eliminating all ID-prefix inference. Based on #32.

New command surface

extract|classify|split runs   get | list | watch | cancel | delete
parse runs                    get | list | watch | delete      # no cancel endpoint
workflows runs                get | list | watch | cancel | delete | update
edit runs                     get | watch | delete             # no list endpoint
edit detections               get                              # form detection runs (new)
extract|parse|classify|split batches   get | watch

workflows run <input> --using workflow_...    # replaces top-level `run`
workflows run batch <inputs>...               # replaces `run batch`

Removed: top-level runs, batches, and run, along with --type on runs list and the --response-type gating. Each typed command carries exactly the flags its kind supports.

How it works

  • internal/extendx: prefix tables are demoted to validation only. ValidateRunID/ValidateBatchID fail fast on a wrong-type ID with a redirect to the owning command (extend extract runs get pr_x → "use 'extend parse runs get pr_x'"). SupportsRunAction keeps redirects honest: an action the actual kind lacks says so instead of naming a nonexistent command.
  • internal/cli: one runsGroupSpec/batchesGroupSpec per kind generates the typed subgroups with capability flags (cancellable, listable, updatable, parse's --response-type, per-kind list filters), following the processors.go accessor pattern.
  • Projections: SKILL.md, help topics, and the command catalog regenerate from the CommandDoc tree; typed leaves appear in the catalog automatically and the workflows family documents its extra run surface parametrically.
  • Contracts: unit tests, strict CommandDoc validation, test/integration, skill evals, and the eval stub all re-pointed at the typed shapes; internal/cli/AGENTS.md example updated.

Warning

Breaking change for every scripted extend runs/batches/run invocation (acceptable per the README's instability warning). Needs a loud release note; a docs PR for cli.mdx/agents.md follows separately, timed with the release.

Test plan

  • go build ./... && go test ./... && go vet ./... green (main module + evals/runner module); gofmt -l clean
  • test/integration compiles; run commands rewritten to typed paths (needs EXTEND_TEST_RUN_OPS=1 for live verification)
  • Manual smoke: help tree, extract runs get pr_x redirect, extract runs cancel pr_x non-cancellable message, edit detections get prefix validation
  • SKILL.md re-rendered within token/line budgets

Run inspection/control and batch status are now typed subgroups under
each action verb (extract/parse/classify/split/edit runs|batches, plus
workflows runs), mirroring the MCP server's per-type tool breakout.
The top-level runs, batches, and run groups are removed; extend run
moves to extend workflows run (and workflows run batch). Each typed
command carries exactly the flags its kind supports, IDs are validated
against the invoked command's kind with a redirect to the owning
command on mismatch, and edit detections get exposes form detection
runs. Skill, help topics, evals, and integration tests are re-pointed
at the typed shapes.
batch.go was carrying two unrelated concerns: the per-verb batch
submit builders with their upload plumbing, and the typed
`<verb> batches get|watch` inspection subgroups. Splitting the
inspection side into batches.go mirrors the runs.go/runs_list.go
layout and pairs with internal/extendx/batches.go. Pure code motion.
The detections group could fetch sgr_ runs but not start them, so the
async POST /form_detection_runs endpoint was unreachable from the CLI.
`extend edit detections create <input>` mirrors the config knobs of the
synchronous `edit schema generate` (--instructions, --input-schema,
--advanced-options) and follows the action-verb wait convention: block
until PROCESSED/FAILED by default, --wait=false to detach and poll with
`edit detections get`.
Cobra returns flag.ErrHelp for non-runnable groups before Args
validation, so removed top-level groups (runs/run/batches) and typed
leaves a kind doesn't have (parse runs cancel, edit runs list,
workflows batches) printed help and exited 0 — silently succeeding
for scripts gating on exit status. Groups are now runnable so NoArgs
rejects unknown subcommands, and the root names the typed replacement
for the three removed group names. A new test pins the exit contract.

Evals: unmodeled typed runs/batches shapes and edit detections no
longer fall through to the action-verb emitters (which fabricated a
fresh successful run out of cleanup/inspection calls); runs delete and
edit detections create/get are modeled; the extract-batch fixture uses
the real bpr_ prefix so ValidateBatchID accepts the follow-up watch;
sgr_ and batch-ID prefixes join the fabrication patterns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant